/************************************************************************
*                                                                       *
*       RTX-51 / CAN  DECLARATIONS FOR C-51 LANGUAGE                    *
*                                                                       *
*                                                                       *
************************************************************************/


/* Message-Structur for receive and send */
struct can_message_struct {
          unsigned int identifier;
          unsigned char c_data[8];
       };


/* System functions returns */
#define C_OK                 0
#define C_NOT_STARTED        1
#define C_CONF_ERROR         2
#define C_OBJ_ERROR          3
#define C_TOO_LONG           4
#define C_INVALID_TYPE       5
#define C_MEM_FULL           6
#define C_NOT_STOPPED        7
#define C_OBJ_REBIND         8
#define C_TIMEOUT            9
#define C_CAN_FAILURE       10
#define C_ERR_ACTIVE        11
#define C_ERR_PASSIVE       12
#define C_BUS_OFF           13
#define C_SEND_ERROR        14


/* Object types for can_def_obj */
#define D_REC           0
#define D_SEND          1
#define D_REC_R_SEND    2
#define D_SEND_R_REC    3


/* System functions */
#pragma SAVE
#pragma REGPARMS

unsigned char can_task_create (void);


unsigned char can_hw_init (unsigned char par_1,
                           unsigned char par_2,
                           unsigned char par_3,
                           unsigned char par_4,
                           unsigned char par_5) large;

unsigned char can_def_obj (unsigned int identifier,
                            unsigned char data_length,
                            unsigned char object_typ);

/* only for 82527 */
unsigned char can_def_obj_ext (unsigned long identifier,
                           unsigned char data_length,
                           unsigned char object_typ);

unsigned char can_stop (void);
unsigned char can_start (void);
unsigned char can_send (void xdata *msg_ptr);
unsigned char can_write (void xdata *msg_ptr);
unsigned char can_receive (unsigned char timeout,
                           void xdata *buffer_ptr);
unsigned char can_bind_obj (unsigned int identifier);
unsigned char can_unbind_obj (unsigned int identifier);
unsigned char can_wait (unsigned char timeout,
                        void xdata *buffer_ptr);
unsigned char can_request (unsigned int identifier);
unsigned char can_read (unsigned int identifier,
                        void xdata *buffer_ptr);
unsigned char can_get_status (void);

#pragma RESTORE
/* End of include */

